# alarm Makefile

HEADERS			= $(wildcard *.h)

# av source need by alarm for record
SOURCES			= $(wildcard *.c)

OBJECTS			= $(SOURCES:%.c=%.o)

MEGA_ROOT			= ..
include $(MEGA_ROOT)/Rules.make

CFLAGS				= -Wall -O2 -I $(MEGA_ROOT)/include 
LDFLAGS			= -lrt -lpthread -lm

JZE_LIB			= jze/jze.a
#HXHT_LIB		= hxht/hxht.a

TARGET				= alarm

#all: $(TARGET)


$(TARGET): $(OBJECTS) $(JZE_LIB) \
			$(MEGA_ROOT)/lib/libmegaEyes.a $(MEGA_ROOT)/lib/libiconv.a $(MEGA_ROOT)/lib/libmxml.a
	$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
	cp $@ $(MEGA_ROOT)/bin

$(OBJECTS): %.o: %.c $(HEADERS) $(JZE_HEADERS)
	$(CC) $(CFLAGS) -c $< -o $@


$(JZE_LIB):
	make -C jze

$(HXHT_LIB):
	make -C hxht

clean:
	@rm -f $(TARGET) $(OBJECTS) $(JZE_OBJECTS)
	make -C jze clean
	make -C hxht clean

